declare @count smallint
declare @startcount smallint
declare @ins_policynumber varchar(8)
declare @lst_policynumber int
declare @policynumber varchar(20)
set @ins_policynumber = 'DMAP10S0'
set @lst_policynumber = 54401
--DMAP10S054401
--Policy Number List History
--DMAP10S054401 to DMAP10S054450 14-07-2010 - Created By Phyo Kyaw Thant
Select @ins_policynumber + cast(@lst_policynumber as varchar) as StartNumber
set @startcount = 0
set @count = 50

--Update tblProviderCarPolicyNumber Set Status = 0 Where IsIssued = 0

--Select * from tblProviderCarPolicyNumber Where IsIssued = 0
while @startcount < @count -- change day count according to month
  begin
	
	set @policynumber = @ins_policynumber + cast(@lst_policynumber as varchar)
	print @policynumber
	
	--INSERT tblProviderCarPolicyNumber(ProviderCompanyId,PolicyNumber, IsIssued, Status)
	--Values(30, @policynumber, 0, 1)
	
	set @startcount = @startcount + 1
	print @startcount
	--print @lst_policynumber
	set @lst_policynumber = @lst_policynumber + 1
	
  end
  
  --Select * into tblProviderCarPolicyNumber_Copy from tblProviderCarPolicyNumber
  --Select * from tblProviderCarPolicyNumber_Copy 